<template>
	<view>
		<view class="content">
			<!-- <image src="@/static/2.jpg"></image> -->
			<image :src="consultation.user.avatar"></image>
			<uni-card :title="consultation.user.nickName" sub-title="资深咨询师" extra="额外信息">
				<text class="introduce">个人简介</text><br />
				<text>{{consultation.introduce}}</text><br />
				<text class="territory">擅长领域</text>
				<uni-card v-for="i in territory">
					<text class="list">{{i}}</text>
				</uni-card>
			</uni-card>
			<view class="beneath">
				<view @click="tz(2,consultation.user.id)">
					<text>立即咨询</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 1,
				consultation: {},
				introduce: [],
				territory: []
			}
		},
		onLoad(option) {
			this.id = option.id;
			console.log(this.id);	
			this.queryId();
		},
		created() {
		},
		methods: {
			queryId() {
				uni.request({
					url: 'http://127.0.0.1:800/mhs/consultation/queryId?id=' + this.id, //仅为示例，并非真实接口地址。
					header: {
					  'token': uni.getStorageSync('token')
					},
					success: (res) => {
						this.consultation = res.data.data;
						var content = "";
						content = res.data.data.territory;
						this.territory = content.split(" ")
						console.log(this.territory)
						console.log(this.consultation)
					},
				});
			},
			tz(id, toid) {
				uni.navigateTo({
					// '/pages/bookDetail/bookDetail?id='
					// console.log(detail),
					// url: "/pages/chat/chat?id="+id+"&"+"toid="+toid,
					url: "/pages/chat/chat?id="+toid,
				})
			}
		}
	}
</script>

<style>
	.content image {
	}

	.introduce {
		font-weight: bold;
	}

	.territory {
		font-weight: bold;
	}

	.beneath {
		display: flex;
		justify-content: center;
		align-items: center;
		width: 100vw;
		height: 10vh;
		position: absolute;
		bottom: 0;
		background-color: #F5F5F5;
	}

	.beneath view {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 33px;
		width: 50%;
		border: 0px;
		outline: none;
		background-color: #3F48CC;
		border-radius: 5%;
	}
	
	.beneath view text{
		color: #ffffff;
	}
</style>